package film.examples;

import java.io.IOException;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

import film.utils.ContentSites;
import film.utils.FilmManager;
import film.webObjs.FilmPage;

public class ContentExample {
	
	
	
	public static void main(String[] args) {
		ContentSites cn=new ContentSites();
		try {
			FilmManager manager= new FilmManager();
			Document doc = Jsoup.connect("http://direkizle.net").get();
			cn.analyzeMainPage(doc);
			cn.lookAtFilmPages();	
			
			doc = Jsoup.connect("http://direkizle.net/page/2").get();
			cn.analyzeMainPage(doc);
			cn.lookAtFilmPages();	
			
			
//			cn.analyzeContent(HtmlParserEx.getContent("http://direkizle.net/page/2"));
//			cn.lookAtFilmPages();
//			cn.analyzeContent(HtmlParserEx.getContent("http://direkizle.net/page/3"));
//			cn.lookAtFilmPages();
			
			for (FilmPage film : cn.getFilmPages()) {
				
				if(film.getVideoLinks()!=null || film.getVideoLinks().size()>0){
				
				System.out.println("--------------------------------------------------------------------------------------------------");
				System.out.println("title:"+film.getName());
				System.out.println("------------------");
				System.out.println(film.getTur().toString());
				System.out.println(film.getAciklama());
				
				manager.addFilm(film);
					
//				for(int i=0;i<film.getVideoLinks().size();i++){
//					System.out.println(film.getVideoLinks().get(i).getLinkServer()+" : "+film.getVideoLinks().get(i).getLink());
//				}
//					
				}

			}
			
			
		} catch (IOException e) {

			e.printStackTrace();
		}
			
	}
}
